package com.kevinxiaoge.ruoli.bean;

import com.kevinxiaoge.ruoli.annotation.Column;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

/**
 * @author chengyuanyuan
 */
@Data
public class User implements UserDetails {
    @Column("id")
    private Integer id;

    @Column("user_name")
    private String username;

    @Column("pass_word")
    private String password;

    @Column("telephone")
    private String telephone;

    @Column("address")
    private String address;

    //@Column("avatar_url")
    private String avatarUrl;

    @Column("enabled")
    private Integer enabled;


    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public String getPassword() {
        return this.password;
    }

    @Override
    public String getUsername() {
        return this.password;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
